/*
 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PLAYERCONTROL_ERR_H
#define PLAYERCONTROL_ERR_H

#include "hi_error_def.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */

/* 0x40~0xFF */
typedef enum {
    APP_PLAYERCONTROL_ERR_INVALID_HANDLE = 0x41,       /**< handle is invalid */
    APP_PLAYERCONTROL_ERR_ILLEGAL_HANDLE = 0x42,       /**< handle is inllegal */
    APP_PLAYERCONTROL_ERR_MEM_MALLOC = 0x43,           /**< memory alloc failed */
    APP_PLAYERCONTROL_ERR_THREAD_CREATE_FAIL = 0x44,   /**< thread create failed */
    APP_PLAYERCONTROL_ERR_MUTEX_INIT_FAIL = 0x45,      /**< thread mutex init failed */
    APP_PLAYERCONTROL_ERR_ADEC_IN_USE = 0x46,          /**< thread mutex init failed */
    APP_PLAYERCONTROL_ERR_CALLBACK_ERROR = 0x47,       /**< playercontrol callback failed */
    APP_PLAYERCONTROL_ERR_ILLEGAL_STATE_ACTION = 0x48, /**< error action in current state */
    APP_PLAYERCONTROL_ERR_DEMUX_ERROR = 0x49,          /**< exec demux error */
    APP_PLAYERCONTROL_ERR_DEMUX_HAS_REG = 0x50,        /**< has reg the demux lib */
    APP_PLAYERCONTROL_ERR_NOT_SUPPORT = 0x51,          /**< not support this action */
    APP_PLAYERCONTROL_ERR_REINITED = 0x52,             /**< playercontrol reinit */
    APP_PLAYERCONTROL_ERR_NOT_INIT = 0x53,             /**< playercontrol no init */
    APP_PLAYERCONTROL_ERR_PLAYERSCH = 0x54,             /**< player schedule exec failed */
    APP_PLAYERCONTROL_ERR_DLOPEN = 0x55,               /**< dlopen failed */
    APP_PLAYERCONTROL_ERR_DLSYM = 0x56,                /**< dlsym failed */
    APP_PLAYERCONTROL_ERR_NOT_REG_DEMUXER = 0x57,      /**< not reg demuxer */
    APP_PLAYERCONTROL_ERR_HAS_CREATE = 0x58,           /**< has create a playercontrol handle before */
    APP_PLAYERCONTROL_ERR_OTHER = 0x59,                /**< unknow error */
    APP_PLAYERCONTROL_ERR_NDK = 0x60,                  /**< ndk error */
    APP_PLAYERCONTROL_ERR_DEMUX_IN_USE = 0x61,         /**< the demux lib is used now */
    APP_PLAYERCONTROL_ERR_ADEC_NOTREG = 0x62,          /**< the adec lib not register */
    APP_PLAYERCONTROL_ERR_ADEC_HAS_REG = 0x63,         /**< the adec lib already register */
    APP_PLAYERCONTROL_ERR_ADEC_ERR = 0x64,             /**< create adec fail */
    APP_PLAYERCONTROL_ERR_MAX_ERR = 0x65,              /**< create player max fail */
    APP_PLAYERCONTROL_ERR_MEM_SET = 0x66,              /**< memory SET failed */
    APP_PLAYERCONTROL_BUTT = 0xFF
} AppPlayerControlErrCode;

/* general error code */
#define HI_APPID_LOCALPLAYER 0x20
#define HI_ERR_PLAYERCONTROL_NULL_PTR  HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_ERR_NULL_PTR)
#define HI_ERR_PLAYERCONTROL_ILLEGAL_PARAM  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_ERR_ILLEGAL_PARAM)
#define HI_ERR_PLAYERCONTROL_ILLEGAL_HANDLE  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_ILLEGAL_HANDLE)
#define HI_ERR_PLAYERCONTROL_MUTEX_INIT_FAIL  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_MUTEX_INIT_FAIL)
#define HI_ERR_PLAYERCONTROL_ADEC_IN_USE  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_ADEC_IN_USE)
#define HI_ERR_PLAYERCONTROL_MEM_MALLOC   \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_MEM_MALLOC)
#define HI_ERR_PLAYERCONTROL_THREAD_CREATE_FAIL   \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_THREAD_CREATE_FAIL)
#define HI_ERR_PLAYERCONTROL_CALLBACK_ERROR  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_CALLBACK_ERROR)
#define HI_ERR_PLAYERCONTROL_ILLEGAL_STATE_ACTION  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_ILLEGAL_STATE_ACTION)
#define HI_ERR_PLAYERCONTROL_DEMUX_ERROR  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_DEMUX_ERROR)
#define HI_ERR_PLAYERCONTROL_DEMUX_HAS_REG  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_DEMUX_HAS_REG)
#define HI_ERR_PLAYERCONTROL_NOT_SUPPORT  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_NOT_SUPPORT)
#define HI_ERR_PLAYERCONTROL_REINITED  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_REINITED)
#define HI_ERR_PLAYERCONTROL_NOT_INIT  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_NOT_INIT)
#define HI_ERR_PLAYERCONTROL_PLAYERSCH  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_PLAYERSCH)
#define HI_ERR_PLAYERCONTROL_DLOPEN  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_DLOPEN)
#define HI_ERR_PLAYERCONTROL_DLSYM  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_DLSYM)
#define HI_ERR_PLAYERCONTROL_NOT_REG_DEMUXER  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_NOT_REG_DEMUXER)
#define HI_ERR_PLAYERCONTROL_HAS_CREATE  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_HAS_CREATE)
#define HI_ERR_PLAYERCONTROL_OTHER  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_OTHER)
#define HI_ERR_PLAYERCONTROL_NDK  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_NDK)
#define HI_ERR_PLAYERCONTROL_DEMUX_IN_USE  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_DEMUX_IN_USE)
#define HI_ERR_PLAYERCONTROL_ADEC_NOT_REG  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_ADEC_NOTREG)
#define HI_ERR_PLAYERCONTROL_ADEC_HAS_REG  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_ADEC_HAS_REG)
#define HI_ERR_PLAYERCONTROL_ADEC_ERROR  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_ADEC_ERR)
#define HI_ERR_PLAYERCONTROL_REACH_MAX  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_MAX_ERR)
#define HI_ERR_PLAYERCONTROL_MEM_SET  \
    HI_APP_DEF_ERR(HI_APPID_LOCALPLAYER, APP_ERR_LEVEL_ERROR, APP_PLAYERCONTROL_ERR_MEM_SET)

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */

#endif /* PLAYERCONTROL_ERR_H */
